<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>扩展运算符</title>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
</body>
<script>
    //扩展运算符 ... 作用：将数组对象转换成以逗号分隔的参数序列。 [1,2,3,4] => 1,2,3,4
    function show(){
        console.log(arguments)
    }
    let tfboys = ['王元凯','王源','易烊千玺'];
    show(tfboys);
    show(...tfboys);

    //实操1 数组拼接
    let arr1 = ['猪八戒','悟空'];
    let arr2 = ['唐僧','沙僧'];
    let xiyouji = [...arr1,...arr2];
    console.log(xiyouji);

    //实操2 数组的克隆
    let newXiyouji = [...xiyouji];
    console.log(`新版西游记 ${newXiyouji}`);



    //实操3 伪数组转真数组
    let divs = document.querySelectorAll('div');
    let arrDivs = [...divs];
    console.log(arrDivs);

</script>
</html>